<?php
class Conditions extends MY_Controller{
	var $menu = array();
	var $hours = array();
	var $shop = array();
	var $delivery_hours = array();
	
	function __construct()
	{
		parent::__construct();
		$this->menu = cat::find('all',array('conditions'=>array('parent_id'=>NULL)));
		$this->hours= hour::find('all',array('order'=>'hour asc'));
		$this->delivery_hours= delivery_hour::find('all',array('order'=>'hour asc'));
		$this->shop = shop::find('all',array('conditions'=>array('status','1')));
	}
	
	function index()
	{
			$s = community::find('all',array('select'=>'limit_price','order'=>'limit_price asc'));
			$d = array();
			foreach ($s as $i){
				$d[] = $i->limit_price;
			}
			$d = array_unique($d);
			$data['limits'] = $d;
			$data['files'] = get_dir_file_info('lunch_pdf', $top_level_only = TRUE);
			$data['title']= $this->title('Conditions');
			$data['shop'] = shop::find('all',array('conditions'=>array('status','1')));
			$data['hours'] = $this->hours;
			$data['coms'] = community::find('all',array('conditions'=>array('status'=>'active')));
			$data['menu'] = cat::find('all',array('conditions'=>array('parent_id'=>NULL)));
			$data['communes'] = community::get_communities();
			$this->load->view('header',$data);
			$this->load->view('conditions');
			$this->load->view('footer');
	}
	
}